﻿using Admin.Core.Model.Xsproject;
using Admin.Core.Service.Xsproject.TaskItem.Input;
using Admin.Core.Service.Xsproject.TaskItem.Output;
using AutoMapper;
using System;
using System.Collections.Generic;
using System.Text;

namespace Admin.Core.Service.Xsproject.TaskItem
{
    /// <summary>
    /// 映射配置
    /// 双向映射 .ReverseMap()
    /// </summary>
    public class MapConfig : Profile
    {
        public MapConfig()
        {
            //新增
            //CreateMap<TaskItemAddInput, TaskItemEntity>();
            //CreateMap<UserUpdateInput, TaskItemEntity>();
            CreateMap<TaskItemEntity, TaskItemListOutput>();

            CreateMap<TaskItemAddInput, TaskItemEntity>();
            CreateMap<TaskItemUpdateInput, TaskItemEntity>().ForMember(
              d => d.ResponId,
              m => m.MapFrom(s => s.ResponName)
            );
            //        .ForMember(
            //  d => d.Status,
            //  m => m.MapFrom(s => s.Status == 0 ? "新建" : s.Status == 1 ? "执行中" : s.Status == 2 ? "已完成" : "")
            //);
            //修改
            //CreateMap<UserChangePasswordInput, TaskItemEntity>();
            //CreateMap<UserUpdateBasicInput, TaskItemEntity>();

            //查询
            //CreateMap<UserEntity, UserGetOutput>().ForMember(
            //    d => d.RoleIds,
            //    m => m.MapFrom(s => s.Roles.Select(a => a.Id))
            //);
            //CreateMap<UserEntity, UserGetOutput>().ForMember(
            //  d => d.RoleIds,
            //  m => m.MapFrom(s => s.Roles.Select(a => a.Id))
            //).ForMember(
            //    d => d.TenantIds,
            //    m => m.MapFrom(s => s.Tenants.Select(a => a.Id))
            //);
            //CreateMap<UserEntity, UserListOutput>().ForMember(
            //    d => d.RoleNames,
            //    m => m.MapFrom(s => s.Roles.Select(a => a.Name))
            //).ForMember(
            //    d => d.TenantNames,
            //    m => m.MapFrom(s => s.Tenants.Select(a => a.Name))
            //);
        }
    }
}
